﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;

namespace NVSecurity
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public void RegisterRoutes(RouteCollection routes)
        {
            routes.MapRoute(
                   name: "News",
                   url: "Tin-tuc/{title}-{id}",
                   defaults: new { controller = "News", action = "Detail", id = UrlParameter.Optional }
                );
            routes.MapRoute(
                name: "Service",
                url: "Dich-vu/{title}-{id}",
                defaults: new { controller = "Service", action = "Detail", id = UrlParameter.Optional }
             );
            routes.MapRoute(
                name: "Recruitment",
                url: "Tuyen-dung/{title}-{id}",
                defaults: new { controller = "Recruitment", action = "Detail", id = UrlParameter.Optional }
             );
            routes.MapRoute(
               name: "Training",
               url: "Dao-tao/{title}-{id}",
               defaults: new { controller = "Training", action = "Detail", id = UrlParameter.Optional }
            );

            routes.MapRoute(
                   name: "Home",
                   url: "Trang-chu",
                   defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
                );
            routes.MapRoute(
                   name: "NewsIndex",
                   url: "Tin-tuc",
                   defaults: new { controller = "News", action = "GetNewsList", id = UrlParameter.Optional }
                );
            routes.MapRoute(
                name: "ServiceIndex",
                url: "Dich-vu",
                defaults: new { controller = "Service", action = "GetServiceList", id = UrlParameter.Optional }
             );
            routes.MapRoute(
                name: "RecruitmentIndex",
                url: "Tuyen-dung",
                defaults: new { controller = "Recruitment", action = "GetRecruitmentList", id = UrlParameter.Optional }
             );
            routes.MapRoute(
               name: "TrainingIndex",
               url: "Dao-tao",
               defaults: new { controller = "Training", action = "GetTrainingList", id = UrlParameter.Optional }
            );
            routes.MapRoute(
               name: "CustomerIndex",
               url: "Khach-hang",
               defaults: new { controller = "Customer", action = "Index", id = UrlParameter.Optional }
            );
            routes.MapRoute(
             name: "Default",
             url: "{controller}/{action}/{id}",
             defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
         );
            
        }
        protected void Application_Start()
        {
            //AreaRegistration.RegisterAllAreas();
            //WebApiConfig.Register(GlobalConfiguration.Configuration);
            //FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            //ControllerBuilder.Current.DefaultNamespaces.Add("NVSecurity.Controllers");
            ////RouteConfig.RegisterRoutes(RouteTable.Routes);
            //BundleConfig.RegisterBundles(BundleTable.Bundles);
            //AuthConfig.RegisterAuth();

            //RegisterRoutes(RouteTable.Routes);


            AreaRegistration.RegisterAllAreas();
            ControllerBuilder.Current.DefaultNamespaces.Add("NVSecurity.Controllers");
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            //RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();

            RegisterRoutes(RouteTable.Routes);
        }
    }
}